/*
 *   Copyright (c) 2010-2022, SIUFUNG
 */
package net.siufung.market.base.tenant.controller.model.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import net.siufung.core.model.AbstractDto;
import net.siufung.core.utils.CopyUtil;
import net.siufung.market.base.tenant.mapper.entity.TenantQuota;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 系统租户配额表 修改数据传参对象
 * </p>
 * @author 陈建峰
 * @since 2022-07-06 14:45:08
 */
@Slf4j
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="TenantQuotaUpdateDto", description="系统租户配额表修改数据传输对象")
public class TenantQuotaUpdateDto extends AbstractDto {

    private static final long serialVersionUID = -4489718914021967492L;

    /**
     * 主键ID
     */
    @ApiModelProperty(value = "主键ID")
    @NotNull(message = "主键ID不能为空!")
    private Integer id;

    /**
     * 配额Key
     */
    @ApiModelProperty(value = "配额Key")
    @NotBlank(message = "配额Key不能为空!")
    @Length(max=32, message="配额Key长度不大于32!")
    private String quotaKey;

    /**
     * 配额Key文本
     */
    @ApiModelProperty(value = "配额Key文本")
    @NotBlank(message = "配额Key文本不能为空!")
    @Length(max=64, message="配额Key文本长度不大于64!")
    private String quotaKeyText;

    /**
     * 配额值
     */
    @ApiModelProperty(value = "配额值")
    @NotBlank(message = "配额值不能为空!")
    @Length(max=64, message="配额值长度不大于64!")
    private String quotaValue;

    /**
     * 租户Id
     */
    @ApiModelProperty(value = "租户Id")
    private Integer tenantId;

    /**
     * 数据标识
     */
    @ApiModelProperty(value = "数据标识")
    private Boolean deleted;

    /**
     * TenantQuota 转化成 TenantQuotaSaveDto 数据领域实体
     * @return TenantQuota
     */
    public TenantQuota to(){
        TenantQuota tenantQuota = new TenantQuota();
        CopyUtil.copyProperties(this, tenantQuota);
        return tenantQuota;
    }
}